<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对事件做出反应-2</title>
    <script>
        function changetext(id) {
            id.innerHTML = "Ooops!";
        }
    </script>
</head>

<body>
    <!-- 本例从事件处理器调用一个函数 -->
    <h1 onclick="changetext(this)">点击文本!</h1>
</body>

</html>